<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        #obox {
            width: 200px;
            height: 200px;
            background: #000;
            position: absolute;
        }
        #obtn {
            position: absolute;
            top: 210px;
        }

        /* 6个类名 */
        .my-enter-to,
        .my-leave {
            left: 0;
            opacity: 1;
        }
        .my-enter,
        .my-leave-to {
            left: 200px;
            opacity: 0;
        }
        .my-enter-active,
        .my-leave-active {
            transition: all 2s;
        }
    </style>
</head>
<body>
    <div id="app">
        <transition name="my">
            <div id="obox" v-if="isShow"></div>
        </transition>
        <button id="obtn" @click="changeShow">按钮</button>
    </div>
    <script src="./vue.js"></script>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                isShow: true
            },
            methods: {
                changeShow() {
                    this.isShow = !this.isShow
                }
            },
        })
    </script>
</body>
</html>